package cn.bgs.controller;

import cn.bgs.pojo.CommunityVo;
import cn.bgs.service.PlotService;
import cn.bgs.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("plot")
public class PlotController {
    @Autowired
    private PlotService plotService;
    @GetMapping("findplot")
    public R plot(){
        List<CommunityVo> communityVo = plotService.findplot();
        return R.ok().data("data",communityVo);
    }
    @GetMapping("delplot")
    public R delplot(Integer id){
        plotService.delplot(id);
        return R.ok();
    }
    @PostMapping("addcommunity")
    public R addcommunity(@RequestBody  CommunityVo forms){
        plotService.addcommunity(forms);
        return R.ok();
    }
    @PostMapping("updatecommunity")
    public R updatecommunity(@RequestBody CommunityVo forms){
        plotService.updatecommunity(forms);
        return R.ok();
    }
}